using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication11.Models.Mapping
{
    public class Hospital_Doctor_ViewMap : EntityTypeConfiguration<Hospital_Doctor_View>
    {
        public Hospital_Doctor_ViewMap()
        {
            // Primary Key
            this.HasKey(t => new { t.doctor_id, t.type_flag, t.status, t.node_id, t.source_id });

            // Properties
            this.Property(t => t.doctor_id)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.type_flag)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.name)
                .HasMaxLength(40);

            this.Property(t => t.id_number)
                .HasMaxLength(20);

            this.Property(t => t.post_code)
                .HasMaxLength(6);

            this.Property(t => t.family_phone)
                .HasMaxLength(20);

            this.Property(t => t.section_office)
                .HasMaxLength(50);

            this.Property(t => t.office_phone)
                .HasMaxLength(20);

            this.Property(t => t.title)
                .HasMaxLength(50);

            this.Property(t => t.mobile_phone)
                .HasMaxLength(20);

            this.Property(t => t.personal_website)
                .HasMaxLength(100);

            this.Property(t => t.doctor_desc)
                .HasMaxLength(50);

            this.Property(t => t.status)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.email)
                .HasMaxLength(50);

            this.Property(t => t.node_id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.age_desc)
                .HasMaxLength(20);

            this.Property(t => t.node_name)
                .HasMaxLength(64);

            this.Property(t => t.source_id)
                .IsRequired()
                .HasMaxLength(4);

            // Table & Column Mappings
            this.ToTable("Hospital_Doctor_View");
            this.Property(t => t.doctor_id).HasColumnName("doctor_id");
            this.Property(t => t.type_flag).HasColumnName("type_flag");
            this.Property(t => t.name).HasColumnName("name");
            this.Property(t => t.gender).HasColumnName("gender");
            this.Property(t => t.birthday).HasColumnName("birthday");
            this.Property(t => t.age).HasColumnName("age");
            this.Property(t => t.id_number).HasColumnName("id_number");
            this.Property(t => t.post_code).HasColumnName("post_code");
            this.Property(t => t.family_phone).HasColumnName("family_phone");
            this.Property(t => t.section_office).HasColumnName("section_office");
            this.Property(t => t.office_phone).HasColumnName("office_phone");
            this.Property(t => t.title).HasColumnName("title");
            this.Property(t => t.mobile_phone).HasColumnName("mobile_phone");
            this.Property(t => t.personal_website).HasColumnName("personal_website");
            this.Property(t => t.doctor_desc).HasColumnName("doctor_desc");
            this.Property(t => t.status).HasColumnName("status");
            this.Property(t => t.email).HasColumnName("email");
            this.Property(t => t.node_id).HasColumnName("node_id");
            this.Property(t => t.d_w_age_id).HasColumnName("d_w_age_id");
            this.Property(t => t.age_desc).HasColumnName("age_desc");
            this.Property(t => t.node_name).HasColumnName("node_name");
            this.Property(t => t.source_id).HasColumnName("source_id");
        }
    }
}
